# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=arcanist
pkgver=0_git20180717
pkgrel=0
pkgdesc="Command line interface for Phabricator"
url="http://www.phabricator.com/docs/arcanist/"
arch="noarch"
license="Apache-2.0"
depends="php7"
depends="php7 php7-curl php-json libphutil"
options="!check" # no checks
subpackages=""
source="https://dev.alpinelinux.org/archive/arcanist/arcanist-$pkgver.tar.gz"
builddir="$srcdir/arcanist-stable"

build() {
	:
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/php/$pkgname \
		"$pkgdir"/usr/bin
	for i in externals resources scripts src; do
		cp -r "$builddir"/$i "$pkgdir"/usr/share/php/$pkgname/
	done
	ln -sf /usr/share/php/$pkgname/scripts/arcanist.php \
		"$pkgdir"/usr/bin/arc
}

snapshot() {
	local pkgver=0_git$(date +%Y%m%d)
	msg "Grabbing the latest stable snapshot"
	mkdir -p "$srcdir"
	wget -O "$srcdir"/$pkgname-$pkgver.tar.gz \
		https://github.com/phacility/arcanist/archive/stable.tar.gz
	ssh distfiles.alpinelinux.org \
		"mkdir -p archive/$pkgname/"
	scp "$srcdir"/$pkgname-$pkgver.tar.gz \
		dev.alpinelinux.org:/archive/$pkgname/
	sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
		"$startdir"/APKBUILD
	sed -i -e "s/^pkgrel=.*/pkgrel=0/" \
		"$startdir"/APKBUILD
	abuild checksum
}

sha512sums="27c544d0da05502ce58ecc5198d0e964e53f44ced64298352b44388b70b345dd87bf0a04fc54f8ab44d32640a0964a5ba54bffeacb9f2cfcc24e004b6ea209d0  arcanist-0_git20180717.tar.gz"
